/**
 * 输入1000 内的斐波那契数列
 */

// 返回第 n 个斐波那契数 
function fibonacci(n) {
    if (n === 1 || n === 2) {
        return 1
    }
    else {
        return fibonacci(n-1) + fibonacci(n-2)
    }
}
/* for (var i = 1; i <= 1000; i++) {
    console.log(fibonacci(i))
} */
var i = 1, result = 0;
while ((result = fibonacci(i)) <= 1000) {
    i = i + 1
    console.log(result)
}